//检查上传文字是否安全

const axios = require('axios');

//传入获取access_token的模块
const getAccessToken = require('./getAccessToken');

module.exports = async (content,openid,scene)=>{
    const access_token = await getAccessToken();
    const URL = `https://api.weixin.qq.com/wxa/msg_sec_check?access_token=${access_token}`;
    const res = await axios.post(URL,{
        openid,
        content,
        scene,
        version:2
    });
    const result = res.data;

    // 只有label为100文字才安全
    if(result.result.label == 100){
        return true;
    }else{
        return false;
    }

}